package com.xiaoyun.util;

import cn.hutool.core.io.resource.ClassPathResource;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import lombok.Data;

import java.io.File;
import java.nio.charset.Charset;

/**
 * @Author: XiaoYun461
 * @Date: 2022/2/22 21:54
 */
@Data
public class BaseJsonService {

    private String jsonName;

    public JSONObject getJsonObj() {
        File file = new ClassPathResource("json/" + this.getJsonName()).getFile();
        JSONObject json = JSONUtil.readJSONObject(file, Charset.defaultCharset());
        //json 转为实体
        return json;
    }


}
